<!DOCTYPE html>
<html>
	<head>
		<title>修改信息</title>
		<meta http-equiv="Pragma" CONTENT="no-cache">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="renderer" content="webkit">

		<%include("/common/include.html"){}%>
	</head>
	<body>

				
			
		<div class="easyui-layout" data-options="fit:true">
		
			<input id="bbexp" type="hidden" value="${bbExp ! }" >
			<input id="kbexp" type="hidden" value="${kbExp! }" >
			<input id="exp" type="hidden" value="${Exp! }" >

			<table id="serviceTable" class="easyui-datagrid" style="height:100%;">
		
			</table>
			<div id="allDatax" style="display:none;"></div>
			<div id="service_tb" >
				日期：
				<input id="service_startTime" value='${startTime! }' class="easyui-datebox theme-textbox-radius"  data-options="editable: false"/>~
				<input id="service_endTime" value='${date(),dateFormat="yyyy-MM-dd"}' class="easyui-datebox theme-textbox-radius" data-options="editable: false"/>
							<a href="#" class="easyui-linkbutton" iconCls="icon-remove" onclick="deleteProduct()">删除服务</a>
					<!-- <a href="#" class="easyui-linkbutton" style="background: #00A65A;color: white;" onclick="update()">确认修改</a> -->
			</div>
		
		</div>
	
			
			
		<script type="text/javascript">
			$(document).ready(function () {
				//加载数据表格
				loadServiceTable();
				$('#service_startTime').datebox({
					onSelect: function(date){
						loadServiceTable();
					}
				});
				$('#service_endTime').datebox({
					onSelect: function(date){
						loadServiceTable();
					}
				});
			});
			
			function  loadServiceTable() {	
				var startTime = $("#service_startTime").val();
				var endTime = $("#service_endTime").val();
				var bbexp = $("#bbexp").val();
				var kbexp = $("#kbexp").val();
				var exp = $("#exp").val();
				
				$('#serviceTable').datagrid({
					cls: "theme-datagrid",
					toolbar: '#service_tb',
					singleSelect: true,
					rownumbers: true, //显示序号
					pagination: true,
					pageSize: 10,
					fitColumns:true,
					url: "${cxt!}/customerInfoStatistic/lookCustomerService",
					queryParams: {
						'_query.customerIds': '${customerIds! }',
						'_query.startTime': startTime,
						'_query.endTime': endTime
					},
				    method: 'post',
					collapsible: true,
					columns:[[
								{field:'ids',title:'ids',width:100,align:'center',hidden:true},
								{field:'ybjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'dtjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'xtjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'gbjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'zfrjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'yfrjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'kbjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'bbjyusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'ybgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'dtgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'xtgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'gbgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'zfrgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'yfrgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'bbgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'kbgusage',title:'ids',width:100,align:'center',hidden:true},
								{field:'weight',title:'本次体重',width:100,align:'center'},
								 {field:'lastweight',title:'体重变化',width:100,align:'center',
									formatter: function(value,row,index){
										var js =  parseFloat(row.weight)- parseFloat(row.lastweight);
										js = js.toFixed(1);
										if(js<0){
											
											return  "<span  style='color:green'>" + "掉秤"+(-js) + "斤"+"<span>";
										}else if(js == 0){
											return "<span  style='color:#00CCFF'>" +js + "<span>";
										}else{
											return  "<span  style='color:red'>" +"涨称"+js + "斤"+ "<span>"
										}
									}	},
								{field:'starttime',title:'开始时间',width:200,align:'center'},
								{field:'endtime',title:'结束时间',width:200,align:'center'},
								{field:'plastercount',title:'是否能量膏',width:100,align:'center',
									formatter: function(value,row,index){
										if(row.plastercount == 1){
											return '是';
										}else{
											return '否';
										}
									}	
								}, 
								{field:'plasterservier',title:'手法人员',width:120,align:'center'},
								/* {field:'isshaping',title:'是否塑形',width:100,align:'center',
									formatter: function(value,row,index){
										if(row.isshaping == 1){
											var customerIds = '${customerIds! }';
											var serviceIds = row.ids;
											return '<a href="#" style="color: blue;" class="button-edit" onclick="lookServiceDetail(\'' + serviceIds + '\')">查看详情</a>';
										}else{
											return '否';
										}
									}	
								}, */
								/* {field:'partsize',title:'部位尺寸',width:100,align:'center',
									formatter: function(value,row,index){
										var ids = row.ids;
										var date = row.date;
										var customerIds = '${customerIds! }';
										var url = '${cxt!}/customerInfoStatistic/toLookCustomerPartSize?serviceIds=' + ids + '&date=' + date + '&customerIds=' + customerIds;
										return '<a href="#" style="color: blue;" class="button-edit" onclick="lookPartSize(\'' + url + '\')">查看详情</a>';
									}	
								}, */
								
								
								{field:'yb',title:'腰部',width:120,align:'center'},
								{field:'dt',title:'大腿',width:120,align:'center'},
								{field:'xt',title:'小腿',width:120,align:'center'},
								{field:'gb',title:'胳膊',width:120,align:'center'},
								{field:'bb',title:'背部',width:120,align:'center'},
								{field:'kb',title:'胯部',width:120,align:'center'},
								{field:'zfr',title:'左副乳',width:120,align:'center'},
								{field:'yfr',title:'右副乳',width:120,align:'center'}
								/* ,
								{field:'update',title:'操作',width:120,align:'center',
									
									formatter:function(value,row,index){
										return '<a onclick='+'btn2(\'' + row.ids + '\',\'' + row.endtime + '\')'+' class='+'button-edit button-success  l-btn l-btn-small'+'><span class='+'l-btn-left'+'><span  style='+'color:green'+' class='+'l-btn-text'+'>修改</span></span></a>';} } */
						    ]]
				})
				
				if(bbexp == 0){
					 $('#serviceTable').datagrid('hideColumn', 'bb');
				}
				if(kbexp == 0){
					 $('#serviceTable').datagrid('hideColumn', 'kb');
				}
				if(exp == 0){
					 $('#serviceTable').datagrid('hideColumn', 'zfr');
					 $('#serviceTable').datagrid('hideColumn', 'yfr');
				}
			}
			
		
		/* 	function btn2(ids,i){
				alert(i);
				//loadViewDialog('修改服务', '${cxt!}/updateServicesController/toUpdate?ids=' + ids+'&date='+i);
				loadViewDialog('查看塑形详情', '${cxt!}/customerInfoStatistic/toLookCustomerServiceDetail?serviceIds=' + ids);
			}
			
			//查看部位尺寸
			function lookPartSize(url){
				loadViewDialog('查看塑形详情', url);
			} */
			
			function deleteProduct(){
				 var row = $("#serviceTable").datagrid('getSelected');
				 if(row == null){
					 $.slideMsg("请选中一条记录！", parent.$);
				 }else{
					 var rowids = row.ids;
					 var ybjyusage = row.ybjyusage;
					 var dtjyusage = row.dtjyusage;
					 var xtjyusage = row.xtjyusage;
					 var gbjyusage = row.gbjyusage;
					 var zfrjyusage = row.zfrjyusage;
					 var yfrjyusage = row.yfrjyusage;
					 var kbjyusage = row.kbjyusage;
					 var bbjyusage = row.bbjyusage;
					 var ybgusage = row.ybgusage;
					 var dtgusage = row.dtgusage;
					 var xtgusage = row.xtgusage;
					 var gbgusage = row.gbgusage;
					 var zfrgusage = row.zfrgusage;
					 var yfrgusage = row.yfrgusage;
					 var kbgusage = row.kbgusage;
					 var bbgusage = row.bbgusage;
					 var customerIds = '${customerIds! }'
					 
					 parent.$.messager.confirm('删除','确定删除？',function(r){
						if (r){
							$.post("${cxt!}/customerInfoStatistic/deleteService",{"ids":rowids},function(result){
								if(result == true){
									$('#serviceTable').datagrid('reload');
								}else{
									$.alert(parent.$,"只能删除最新一条服务记录");
								}
								
								
							});
							
						/* 	
							$.post("${cxt!}/customerInfoStatistic/deleteService",
									{"ids":rowids,"ybjyusage":ybjyusage,"dtjyusage":dtjyusage,"xtjyusage":xtjyusage,"gbjyusage":gbjyusage,
									 "zfrjyusage":zfrjyusage,"yfrjyusage":yfrjyusage,"kbjyusage":kbjyusage,"bbjyusage":bbjyusage,
									 "ybgusage":ybgusage,"dtgusage":dtgusage,"xtgusage":xtgusage,"gbgusage":gbgusage,
									 "zfrgusage":zfrgusage,"yfrgusage":yfrgusage,"kbgusage":kbgusage,"bbgusage":bbgusage,}
									,function(result){
								$('#serviceTable').datagrid('reload');
							}); */
						}
					 });
				 }
			}
		</script>
		
		</body>
</html>	
			